<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>验证</title>
  <link href="../Styles/styles.css" rel="stylesheet" type="text/css"/>
</head>

<body>
  <h2 id="validation">验证方式</h2>

  <p class="h2subheading">— 确保您的 EPUB 没有错误 —</p>

  <p>In order to be considered a valid EPUB, your ebook must meet the standards defined for EPUBs. This means it must include certain files and information and not contain any errors as defined by the EPUB specification. To help you check if your EPUB is valid you can use the following tools.</p>
  <p>为了被视为有效的 EPUB，您的电子书必须符合为EPUB定义的标准。这意味着它必须包含某些文件和信息，并且不包含 EPUB 规范定义的任何错误。为了帮助您检查EPUB是否有效，可以使用以下工具。</p>

  <h3 class="sigil_not_in_toc">使用 FlightCrew 进行 EPUB 验证（仅适用于 Epub2）</h3>

  <p>Please note that FlightCrew is no longer included in Sigil and has been converted to an optional plugin. (If you press F7 or click the green checkmark icon <img alt="" src="../Images/document-validate_22px.png"/>, Sigil will run a well-formedness check.)</p>
  <p>请注意，FlightCrew 不再包含在 Sigil 中，并且已转换为可选插件。（如果按 F7 或单击绿色的选中标记图标 <img alt="" src="../Images/document-validate_22px.png"/>，Sigil 将运行格式正确的检查。）</p>

  <p>Before you can use FlighCrew, you’ll have to download the <a href="https://github.com/Sigil-Ebook/flightcrew/releases/latest"> FlighCrew plugin .zip file</a> for your OS and <a href="../Text/manage_plugins.html">install it</a>.</p>
  <p>在使用 FlighCrew 之前，您必须为您的操作系统下载 <a href="https://github.com/Sigil-Ebook/flightcrew/releases/latest">FlighCrew plugin .zip 文件</a> <a href="../Text/manage_plugins.html">安装</a>。</p>

  <p>To run FlightCrew select Plugins &gt; Validation &gt; FlightCrew.</p>
  <p>要运行 FlightCrew，请选择“插件 &gt; 验证 &gt; FlightCrew”。</p>

  <p>This will display a new window underneath your editing window listing any issues that it finds. Once you have run FlightCrew to produce a report, look at each of the issues listed and then edit your document to correct them.</p>
  <p>这将在您的编辑窗口下方显示一个新窗口，列出它发现的所有问题。运行 FlightCrew 生成报告后，查看列出的每个问题，然后编辑文档以更正它们。</p>

  <div class="image">
    <img alt="validation-flightcrew" src="../Images/validation-flightcrew.png"/>
  </div>

  <div class="tip">
    <p class="tiptext">You can double-click on most entries to be taken to the relevant part of the book.</p>
    <p class="tiptext">您可以双击大多数条目以进入本书的相关部分。</p>
  </div>

  <p>You should validate your document each time you change it to verify there are no more errors.</p>
  <p>每次更改文档时，都应验证您的文档以确认没有更多错误。</p>

  <h4 class="sigil_not_in_toc">常见验证问题：</h4>

  <div class="tip">
    <p class="tiptext">Note that errors are highlighted in pink, and warnings are highlighted in yellow.</p>
    <p class="tiptext">请注意，错误以粉色突出显示，警告以黄色突出显示。</p>
  </div>

  <ul>
    <li><span class="example">This resource is present in the OPF &lt;manifest&gt;, but it’s not reachable (it’s unused).</span> 

    <ul>
      <li>This warning means you have included the listed file in your EPUB, but you have not used it anywhere in your book. If you intended to use it, you should link to it, otherwise you can delete the file. Try to search all your files or <span class="example">toc.ncx</span> for the filename – you should leave off the pathname when searching, e.g. if the error is in <span class="example">Text/Chapter1.html</span> then just search for <span class="example">Chapter1.html</span></li>
    </ul></li>
    <li><span class="example">该资源存在于 OPF &lt;manifest&gt; 中，但无法访问（未使用）。</span> 

    <ul>
      <li>此警告表示您已将列出的文件包含在 EPUB 中，但未在书中的任何位置使用它。如果要使用它，则应链接到它，否则可以删除该文件。尝试搜索所有文件或 <span class="example">toc.ncx</span> 查找文件名 - 搜索时应保留路径名，例如 如果错误出在 <span class="example">Text/Chapter1.html</span> 中，则只需搜索 <span class="example">Chapter1.html</span></li>
    </ul></li>

    <li><span class="example">This OPS document is reachable but not present in the OPF &lt;manifest or spine&gt;. "Reachable" means that a reference of some kind that points to this resource exists in the EPUB.</span> 

    <ul>
      <li>This error means you have a reference or a link to a file or image in your EPUB, but that file is not included in the EPUB. You need to add the file to the EPUB or correct the name of the file used in your text. You can usually find these by searching for the filename listed in all the HTML files. You may also have to re-generate or update your TOC.</li>
    </ul></li>
    <li><span class="example">此 OPS 文档可访问，但不存在于 OPF &lt;manifest 或spine&gt; 中。“可达到”是指 EPUB 中存在指向该资源的某种引用。</span> 

    <ul>
      <li>此错误表示您在 EPUB 中具有文件或图像的引用或链接，但该文件未包含在 EPUB 中。您需要将文件添加到 EPUB 或更正文本中使用的文件名。通常，您可以通过搜索所有 HTML 文件中列出的文件名来找到这些文件。您可能还必须重新生成或更新您的目录。</li>
    </ul></li>

    <li><span class="example">ID value 'SOMEIDNAME' is not unique</span> 

    <ul>
      <li>This error means you have an ID named SOMEIDNAME in your EPUB that is defined more than once. Typically these are in headers or footnotes and can be caused by copying and pasting or merging. You can find these by searching all HTML files for the ID name that is listed and changing them so all IDs are different from all other IDs. If the issue is in a heading and you have auto-generated your headings, you can delete the ID and they will be re-generated the next time you create your TOC.</li>
    </ul></li>
    <li><span class="example">ID 值“SOMEIDNAME”不是唯一的</span> 

    <ul>
      <li>此错误意味着您的 EPUB 中有一个名为 SOMEIDNAME 的 ID，该 ID 被多次定义。通常，它们在页眉或脚注中，并且可能是由于复制，粘贴或合并引起的。您可以通过在所有 HTML 文件中搜索列出的 ID 名称并进行更改以使所有 ID 与所有其他 ID 不同来找到它们。如果问题出在标题上，并且您已经自动生成了标题，则可以删除该 ID，并且下次创建目录时将重新生成它们。</li>
    </ul></li>

    <li><span class="example">attribute 'INVALIDATTRIBUTE' is not declared for element 'SOMEELEMENT'</span> 

    <ul>
      <li>This error means you have an HTML tag named SOMEELEMENT that contains an attribute INVALIDATTRIBUTE, but INVALIDATTRIBUTE is not valid for that tag. For instance <span class="example">&lt;h2 invalidattribute="test"&gt;</span>. This can be caused by typos or by old versions of HTML. You need to search for INVALIDATTRIBUTE in all HTML files and remove, correct, or replace each occurrence.</li>
    </ul></li>
    <li><span class="example">没有为元素“SOMEELEMENT”声明属性“INVALIDATTRIBUTE”</span> 

    <ul>
      <li>此错误表示您有一个名为 SOMEELEMENT 的 HTML 标记，其中包含属性 INVALIDATTRIBUTE，但是 INVALIDATTRIBUTE 对该标记无效。例如 <span class="example">&lt;h2 invalidattribute="test"&gt;</span>。这可能是由于输入错误或 HTML 的旧版本引起的。您需要在所有 HTML 文件中搜索 INVALIDATTRIBUTE，然后删除，更正或替换每个匹配项。</li>
    </ul></li>

    <li><span class="example">no declaration found for element 'INVALIDELEMENT'</span> 

    <ul>
      <li>This error means you have an HTML tag named INVALIDELEMENT that has not been defined. Typically this is simply because it is invalid and is old HTML syntax that need updating. You need to search for INVALIDELEMENT in all HTML files and remove, correct, or replace these with valid HTML.</li>
    </ul></li>
    <li><span class="example">找不到元素“INVALIDELEMENT”的声明</span> 

    <ul>
      <li>此错误表示您有一个尚未定义的名为 INVALIDELEMENT 的 HTML 标记。通常，这仅仅是因为它无效并且是需要更新的旧 HTML 语法。您需要在所有 HTML 文件中搜索 INVALIDELEMENT，然后将其删除，更正或替换为有效的 HTML。</li>
    </ul></li>

    <li><span class="example">element 'INVALIDELEMENT' is not allowed for content model '(p|d|h2|h3|h4|h5|h6|div|ul|ol|...'</span> 

    <ul>
      <li>This error means you have an HTML tag named INVALIDELEMENT that is not valid HTML for an EPUB. Typically this is old HTML syntax that needs updating (such as the <span class="example">&lt;center&gt;</span> tag which should be implemented using a style). You need to search for INVALIDELEMENT in all HTML files and remove, correct, or replace each occurrence with valid HTML.</li>
    </ul></li>
    <li><span class="example">内容模型‘(p|d|h2|h3|h4|h5|h6|div|ul|ol|……’不允许使用元素'INVALIDELEMENT'</span> 

    <ul>
      <li>此错误表示您有一个名为 INVALIDELEMENT 的 HTML 标记，该标记对于 EPUB 无效。通常，这是需要更新的旧 HTML 语法（例如 <span class="example">&lt;center&gt;</span> 标记，应使用样式来实现）。您需要在所有 HTML 文件中搜索 INVALIDELEMENT，然后用有效的 HTML 删除，更正或替换每个匹配项。</li>
    </ul></li>

    <li><span class="example">value 'SOMENAME' is invalid NCName</span> 

    <ul>
      <li>This error means you have an ID name that is invalid. It probably contains a space or other invalid character. You need to search for SOMENAME and change it.</li>
    </ul></li>
    <li><span class="example">值‘SOMENAME’是无效的 NCName</span> 

    <ul>
      <li>此错误表示您的 ID 名称无效。它可能包含空格或其他无效字符。您需要搜索并更改 SOMENAME。</li>
    </ul></li>
  </ul>

  <h3 class="sigil_not_in_toc" id="tidy">W3C 的 CSS 验证</h3>

  <p>You can also easily validate your CSS Stylesheet files using the W3C website by selecting the menu item <span class="menuitem">Tools→Validate Stylesheets With W3C</span>.</p>
  <p>您还可以通过选择菜单项 <span class="menuitem">工具→使用 W3C 验证样式表</span>，轻松地使用 W3C 网站验证 CSS 样式表文件。</p>

  <p>This will send the contents of all of your stylesheets to the W3C service which will produce reports of any issues.</p>
  <p>这会将所有样式表的内容发送到 W3C 服务，该服务将生成任何问题的报告。</p>

  <p>You can validate individual stylesheets by right-clicking on the stylesheet in the Book Browser and selecting the validate option.</p>
  <p>您可以通过在“书籍浏览器”中右键单击样式表并选择“验证”选项来验证各个样式表。</p>

  <div class="tip">
    <p class="tiptext">Validation is done using the W3C Stylesheet Validation Level that was selected in the Preferences menu (<span class="menuitem">Edit→Preferences→General Settings→EPUB2/3 W3C Stylesheet Validation Level</span>).</p>
    <p class="tiptext">使用“首选项”菜单中的 W3C 样式表验证级别（<span class="menuitem">编辑→首选项→常规设置→EPUB2/3 W3C 样式表验证级别</span>）进行验证。</p>
  </div>

  <h3 class="sigil_not_in_toc">使用 EpubCheck 进行 EPUB 验证（Epub2 和 Epub3）</h3>

  <p>FlightCrew identifies most issues with EPUBs, but it may not catch everything and can’t be used to validate EPUB3 books.</p>
  <p>FlightCrew 发现了 EPUB 的大多数问题，但可能无法解决所有问题，因此不能用于验证 EPUB3 图书。</p>

  <p>As an additional check you should also run your EPUB through the EpubCheck program. You can use it online or download a local version of the program:</p>
  <p>作为附加检查，您还应该通过 EpubCheck 程序运行 EPUB。您可以在线使用它或下载程序的本地版本：</p>

  <ul>
    <li><a href="http://validator.idpf.org">IDPF EPUB Validator</a></li>
  </ul>

  <p>You can also install an <a href="http://www.mobileread.com/forums/showpost.php?p=2950625">epubcheck plugin</a>.</p>
  <p>您还可以安装 <a href="http://www.mobileread.com/forums/showpost.php?p=2950625">epubcheck 插件</a>。</p>

  <h3 class="sigil_not_in_toc">设备的 EPUB 验证</h3>

  <p>And in case you missed it: You should always test your EPUB on as many devices or programs as possible.</p>
  <p>如果您错过了它：您应该始终在尽可能多的设备或程序上测试 EPUB。</p>
</body>
</html>